#!/usr/bin/env python3
import os
import sys
import json

result = json.loads(open("result.json").read())
if result["result"] == "success":
	print("[+] \""+str(sys.argv[1])+"\" uploaded.")
	os.system("touch upresult.ok")
elif result["result"] == "error":
	print("[!] \""+str(sys.argv[1])+"\" upload failed. Response: \""+result["message"]+"\"")
	os.system("touch upresult.err")
else:
	print("[!] File uploaded?... (parsing/response error)")

os.system("rm -f result.json")
